package com.ssy.lingxi.platform.manage.controller.mobile;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.manage.api.model.app.AppShopTypeSelectVO;
import com.ssy.lingxi.platform.manage.api.model.vo.site.SiteShopVO;
import com.ssy.lingxi.platform.manage.entity.base.Shop;
import com.ssy.lingxi.platform.manage.model.request.shop.ShopAllReq;
import com.ssy.lingxi.platform.manage.model.response.SelfBusinessShopListResp;
import com.ssy.lingxi.platform.manage.service.mobile.IShopMobileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu mobile - 商城
 *
 * @author fhj
 * @version 2.0.0
 * @date 2021/09/27
 */
@Api(tags = "mobile - 商城")
@RestController
@RequestMapping("/manage/mobile/shopMobile")
public class ShopMobileController extends BaseController {

    @Resource
    private IShopMobileService shopMobileService;


    @ApiOperation(value = "根据商城类型获取站点商城列表")
    @GetMapping("/siteShopList")
    public Wrapper<List<SiteShopVO>> siteShopListByType(Integer type) {
        return shopMobileService.siteShopListByType(type);
    }

    @ApiOperation(value = "启动页商城列表")
    @GetMapping("/startPageShopList")
    public Wrapper<List<Shop>> startPageShopList(Long siteId) {
        return shopMobileService.startPageShopList(siteId);
    }

    @ApiOperation(value = "自营商家商城列表")
    @GetMapping("/selfBusinessShopList")
    public Wrapper<List<SelfBusinessShopListResp>> selfBusinessShopList(Long shopId) {
        return shopMobileService.selfBusinessShopList(shopId);
    }

    @ApiOperation(value = "所有")
    @PostMapping("/all")
    public Wrapper<List<Shop>> all(@RequestBody @Valid ShopAllReq req) {
        return shopMobileService.all(req);
    }

    @ApiOperation(value = "app或小程序商城类型选择")
    @GetMapping("/appShopTypeSelect")
    public Wrapper<List<AppShopTypeSelectVO>> appShopTypeSelect(@RequestParam(value = "environment", defaultValue = "3") Integer environment) {
        return shopMobileService.appShopTypeSelect(environment);
    }

    @ApiOperation(value = "判断商城是否由会员来运营行情资讯门户")
    @GetMapping("/checkShopMemberOperate")
    public Wrapper<Integer> checkShopMemberOperate(Long shopId) {
        return shopMobileService.checkShopMemberOperate(shopId);
    }
}
